home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / Alpha 6.5.sit / Tcl / SystemCode / menus.tcl < prev    next >
Text File  |  1996-08-16  |  10KB  |  551 lines

  1. # My menus.        
  2.  
  3. if !$alphaLite {
  4.     menu -n File -p fileMenuProc {
  5.         "/Nnew"
  6.         "/Oopenノ"
  7.         {menu -n recent {}}
  8.         "<S/Wclose"
  9.         "<S<I<O/WcloseAll"
  10.         "(-"
  11.         "<S/Ssave"
  12.         "<S<I<O/SsaveAll"
  13.         "<SsaveACopyAsノ"
  14.         "<SsaveAsノ"
  15.         "<E<SrevertToBackup"
  16.         "<Srevert"
  17.         "(-"
  18.         "<S/Y<Oshell"
  19.         "<S/Y<U<Ocalculator"
  20.         "<S/Y<B<OtoolserverShell"
  21.         "(-"
  22.         "pageSetupノ"
  23.         {menu -n print {}}
  24.         "(-"
  25.         "/Qquit"
  26.     }
  27.  
  28.     menu -n Edit {
  29.         "/Zundo"
  30.         "/Z<I<Oredo"
  31.         "/Lload"
  32.         "(-"
  33.         "/X<Scut"
  34.         "/X<S<I<Ocut&Append"
  35.         "/C<Scopy"
  36.         "/C<S<I<Ocopy&Append"
  37.         "/V<Spaste"
  38.         "/V<S<I<OpastePop"
  39.         "/A<SselectAll"
  40.         "/A<S<I<OselectParagraph"
  41.         "clear"
  42.         "(-"
  43.         {menu -n emacs {}}
  44.         "/`<Stwiddle"
  45.         "/`<S<I<OtwiddleWords"
  46.         "(-"
  47.         {/[<SshiftLeft}
  48.         {/[<S<I<OshiftLeftSpace}
  49.         {/]<SshiftRight}
  50.         {/]<S<I<OshiftRightSpace}
  51.         "/Bbalance"
  52.     }
  53.  
  54.     menu    -n Text {
  55.             "/I<SfillParagraph"
  56.             "/I<S<O<IwrapParagraph"
  57.             "/I<S<O<I<UsentenceParagraph"
  58.             "/U<S<OfillRegion"
  59.             "/U<S<I<OwrapRegion"
  60.             "/U<S<O<I<UsentenceRegion"
  61.             "<E<SparagraphToLine"
  62.             "<SlineToParagraph"
  63.             "(-"
  64.             "<SreverseSort"
  65.             "<SsortLines"
  66.             "/L<I<OspellcheckWindow"
  67.             "(-"
  68.             "zapInvisibles"
  69.             "<SspacesToTabs"
  70.             "<StabsToSpaces"
  71.             "<S<EindentRegion"
  72.             "<SindentLine"
  73.             "<E<SdowncaseRegion"
  74.             "<SupcaseRegion"
  75.             "(-"
  76.             {menu -n Strings {
  77.                 "<SremovePrefix"
  78.                 "<SinsertPrefix"
  79.                 "<S<EremoveSuffix"
  80.                 "<SinsertSuffix"
  81.                 "setPrefix"
  82.                 "setSuffix"
  83.                 }}
  84.             "/D<ScommentLine"
  85.             "/D<S<I<OuncommentLine"
  86.             "<SuncommentBox"
  87.             "<ScommentBox"
  88.             "<S<EuncommentParagraph"
  89.             "<ScommentParagraph"
  90.             "(-"
  91.             "/=markHilite"
  92.             {menu -n namedMarks -p namedMarkProc {
  93.                 "/K<Osetノ"
  94.                 "/K<I<Ogotoノ"
  95.                 "removeノ"
  96.                 "(-"
  97.                 "sort"
  98.                 "sortByPosition"}}
  99.             {menu -n unnamedMarks -p unnamedMarkproc {
  100.                 "setノ"
  101.                 "exchangePointAndMark"}}
  102.     }
  103.  
  104.     menu -n "Utils" {
  105.             {menu -n fileUtils {
  106.                 "insertPathNameノ"
  107.                 "insertFileノ"
  108.                 "fileRemoveノ"
  109.                 "fileInfoノ"
  110.                 "wordCount"
  111.                 "textToAlpha"}}
  112.             {menu -m -n compare -p compareProc {
  113.                 "Windows"
  114.                 "Filesノ"
  115.                 "Directoriesノ"}}
  116.             {menu -n asciiEtc {
  117.                 "quoteChar"
  118.                 "(-"
  119.                 "keyCode"
  120.                 "keyAscii"
  121.                 "getAscii"
  122.                 "insertAscii"}}
  123.             {menu -n KbdMacros {
  124.                 "/qstartKeyboardMacro"
  125.                 "/rendKeyboardMacro"
  126.                 "/sexecuteKeyboardMacro"
  127.                 "dumpMacro"}}
  128.             "(-"
  129.             "sendUrl"
  130.             {menu -m -n switchTo -p switchProc {}}
  131.             "(-"
  132.             "/M<I<OmatchingLines"
  133.             "gotoMatch"
  134.             "nextMatch"
  135.             "(-"
  136.             "/jcmdDoubleClick"
  137.     }
  138.     menu    -n Config {
  139.         {menu -n "Current Mode" -p modeOptions {
  140.             "menusノ"
  141.             "flagsノ"
  142.             "editPrefs"
  143.             "loadPrefsノ"
  144.             "describeMode"
  145.             "(-"
  146.             "/m<Uchangeノ"
  147.         }}
  148.         {menu -n Global -p globalOptions {
  149.             "menusノ"
  150.             "flagsノ"
  151.             "editPrefs"
  152.             "listBindings"
  153.             "listFunctions"}}
  154.         "suffixMappingsノ"
  155.         "/kdescribeBinding"
  156.         "viewSavedSettingノ"
  157.         "removeSavedSettingノ"
  158.         "(-"
  159.         {menu -n appPaths {}}
  160.         {menu -m -n install -p installProc {
  161.             "Electric Alias"
  162.             "(-"
  163.             "LaTeX 2e"
  164.             "LaTeX 2.09"}}
  165.         "deconstructノ"
  166.         "(-"
  167.         "/lsetFontsTabsノ"
  168.         {menu -n redefineColors -p colorProc {
  169.             foreground
  170.             background
  171.             "(-"
  172.             blue
  173.             cyan
  174.             green
  175.             magenta
  176.             red
  177.             white
  178.             yellow
  179.             "(-"
  180.             color_9
  181.             color_10
  182.             color_11
  183.             color_12
  184.             color_13
  185.             color_14
  186.             color_15}}
  187.     }
  188.  
  189.     menu -n $winMenu -p menuWin {
  190.             "//<Szoom"
  191.             "//<S<I<OsinglePage"
  192.             "<S/;chooseAWindow"
  193.             "/I<Biconify"
  194.             {menu -n arrange -p winTileProc {
  195.                 "/Jvertically^1"
  196.                 "/J<O<Ihorizontally^2"
  197.                 "/J<B<OunequalVert^6"
  198.                 "/J<B<I<OunequalHor^5"
  199.                 "(-"
  200.                 {menu -n other {
  201.                     {bufferOtherWindow}
  202.                     {iconify}
  203.                     {nextWin}
  204.                     {nextWindow}
  205.                     {prevWindow}
  206.                     {shrinkFull}
  207.                     {shrinkHigh}
  208.                     {shrinkLeft}
  209.                     {shrinkLow}
  210.                     {shrinkRight}
  211.                     {singlePage}
  212.                     {swapWithNext}
  213.                     {zoom}
  214.                 }}}}
  215.             "(-"
  216.             "/msplitWindow"
  217.             "/otoggleScrollbar"
  218.             "(-"
  219.     }
  220. } else {
  221.     menu -n File -p fileMenuProc {
  222.         "/Nnew"
  223.         "/Oopenノ"
  224.         {menu -n recent {}}
  225.         "<S/Wclose"
  226.         "<S<I<O/WcloseAll"
  227.         "(-"
  228.         "<S/Ssave"
  229.         "<S<I<O/SsaveAll"
  230.         "<SsaveAsノ"
  231.         "<E<SrevertToBackup"
  232.         "<Srevert"
  233.         "(-"
  234.         "pageSetupノ"
  235.         "/Pprintノ"
  236.         "(-"
  237.         "/Qquit"
  238.     }
  239.  
  240.     menu -n Edit {
  241.         "/Zundo"
  242.         "/Z<I<Oredo"
  243.         {menu -n emacs {}}
  244.         "(-"
  245.         "/X<Scut"
  246.         "/X<S<I<Ocut&Append"
  247.         "/C<Scopy"
  248.         "/C<S<I<Ocopy&Append"
  249.         "/V<Spaste"
  250.         "/V<S<I<OpastePop"
  251.         "/A<SselectAll"
  252.         "/A<S<I<OselectParagraph"
  253.         "clear"
  254.         "(-"
  255.         "/=selectLast"
  256.         "/`<Stwiddle"
  257.         "/`<S<I<OtwiddleWords"
  258.     }
  259.  
  260.     menu -n Text {
  261.         "/I<SfillParagraph"
  262.         "/I<S<O<IwrapParagraph"
  263.         "/I<S<O<U<I<BsentenceParagraph"
  264.         "/U<S<OfillRegion"
  265.         "/U<S<I<OwrapRegion"
  266.         "/U<S<O<U<I<BsentenceRegion"
  267.         "<E<SupcaseRegion"
  268.         "<SdowncaseRegion"
  269.         "(-"
  270.         "<SreverseSort"
  271.         "<SsortLines"
  272.         "/L<I<OspellcheckWindow"
  273.         "zapInvisibles"
  274.         "<SspacesToTabs"
  275.         "<StabsToSpaces"
  276.         "(-"
  277.         "/D<ScommentLine"
  278.         "/D<S<I<OuncommentLine"
  279.         "<SuncommentBox"
  280.         "<ScommentBox"
  281.         "<S<EuncommentParagraph"
  282.         "<ScommentParagraph"
  283.         "(-"
  284.         "textToAlpha"
  285.     }
  286.  
  287.     menu    -n Config {
  288.         {menu -n "Current Mode" -p modeOptions {
  289.             "menusノ"
  290.             "flagsノ"
  291.             "editPrefs"
  292.             "loadPrefsノ"
  293.             "describeMode"
  294.             "(-"
  295.             "/m<Uchangeノ"
  296.         }}
  297.         {menu -n Global -p globalOptions {
  298.             "menusノ"
  299.             "flagsノ"
  300.             "editPrefs"
  301.             "listBindings"
  302.             "listFunctions"}}
  303.         "suffixMappingsノ"
  304.         "(-"
  305.         "/kdescribeBinding"
  306.         "viewSavedSettingノ"
  307.         "removeSavedSettingノ"
  308.         "(-"
  309.         "/lsetFontsTabsノ"
  310.     }
  311.  
  312.     menu -n $winMenu -p menuWin {
  313.             "//<Szoom"
  314.             "//<S<I<OsinglePage"
  315.             "<S/;chooseAWindow"
  316.             "/I<Biconify"
  317.             {menu -n arrange -p winTileProc {
  318.                 "/Jvertically^1"
  319.                 "/J<O<Ihorizontally^2"
  320.                 "/J<B<OunequalVert^6"
  321.                 "/J<B<I<OunequalHor^5"
  322.                 "(-"
  323.                 }}
  324.             "(-"
  325.             "/isetFontsTabsノ"
  326.             "/msplitWindow"
  327.             "/otoggleScrollbar"
  328.             "(-"
  329.     }
  330. }
  331.  
  332.  
  333. proc fileMenuProc {menu item} {
  334.     if {$item == "open"} {
  335.         findFile
  336.     } elseif {$item == "close"} {
  337.         killWindow
  338.     } else {
  339.         $item
  340.     }
  341. }
  342.  
  343.  
  344.  
  345.  
  346.  
  347. menu -n Search {
  348.     "/F<Sfindノ"
  349.     "/F<S<I<OsearchStart"
  350.     "/G<SfindAgain"
  351.     "/G<S<I<OfindAgainBackward"
  352.     "/MfindInNextFile"
  353.     "/E<SenterSearchString"
  354.     "/E<S<I<OenterReplaceString"
  355.     "(-"
  356.     "/S<BquickFind"
  357.     "/R<BreverseQuickFind"
  358.     "(-"
  359.     "/Rreplace"
  360.     "/Hreplace&FindAgain"
  361.     "<S/R<O<IreplaceAll"
  362.     "<S/R<O<I<BreplaceInFileset"
  363.     "(-"
  364.     "/,<BpushPosition"
  365.     "/.<BpopPosition"
  366.     "/G<IgotoLine"
  367. }
  368. proc pushPosition {} {pushMark}
  369. proc popPosition {} {popMark}
  370. #     {menu -n NamedClipboards -p namedClipMenuProc {"copyノ" "cutノ" "pasteノ"}}
  371. #     {menu -n registers { pointToRegister jumpToRegister }}
  372.  
  373. proc namedMarkProc {menu item} {
  374.     switch $item {
  375.         "markFile"            {markFile; message "File marked."}
  376.         "set"                 {setNamedMark}
  377.         "goto"                {gotoFileMark}
  378.         "remove"            {removeNamedMark}
  379.         "sort"                {sortMarksFile}
  380.         "sortByPosition"    {orderMarks}
  381.     }
  382. }
  383.  
  384. proc unnamedMarkproc {menu item} {
  385.     switch $item {
  386.         "set"                     {setMark}
  387.         "exchangePointAndMark"    {exchangePointAndMark}
  388.         "hilite"                {markHilite}
  389.     }
  390. }
  391.     
  392. proc installProc {menu item} {
  393.     switch $item {
  394.         "Electric Alias"     {loadElectricAlias}
  395.         "LaTeX 2.09"        {loadLaTeX}
  396.         "LaTeX 2e"            {loadLaTeX}
  397.     }
  398. }
  399.  
  400.  
  401.  
  402. proc compareProc {menu item} {
  403.     catch {compare$item} msg
  404.     message $msg
  405. }
  406.  
  407. proc namedClipMenuProc {menu item} {
  408.     switch $item {
  409.         "copy"         "copyNamedClipboard"
  410.         "cut"         "cutNamedClipboard"
  411.         "paste"     "pasteNamedClipboard"
  412.     }
  413. }
  414.  
  415.         
  416.  
  417.  
  418.  
  419. proc colorProc {menu item} {
  420.     global colorInds modifiedArrVars
  421.     if {[info exists colorInds($item)]} {
  422.         set color [eval [list colorTriple "New ¥"$item¥":"] $colorInds($item)]
  423.     } else {
  424.         switch $item {
  425.             foreground    { set inds "0 0 0" }
  426.             background    { set inds "65535 65535 65535" }
  427.             blue        { set inds "0 0 65535" }
  428.             cyan        { set inds "61404 11464 34250" }
  429.             green        { set inds "1151 33551 8297" }
  430.             magenta        { set inds "44790 1591 51333" }
  431.             red            { set inds "65535 0 0" }
  432.             white        { set inds "65535 65535 65535" }
  433.             yellow        { set inds "61834 64156 12512" }
  434.             default        { set inds "65535 65535 65535" }
  435.         }
  436.         set color [eval [list colorTriple "New ¥"$item¥":"] $inds]
  437.     }
  438.     eval setRGB $item $color
  439.  
  440.     set colorInds($item) $color
  441.     lappend modifiedArrVars colorInds
  442. }
  443.  
  444.  
  445.         
  446. #===============================================================================
  447. proc helpMenu {item} {
  448.     global HOME
  449.     if {$item == "Alpha Manual"} {
  450.         edit -r "$HOME:Help:Manual"
  451.     } else {
  452.         edit -r "$HOME:Help:$item"
  453.     }
  454. }
  455.  
  456. if {![catch {glob "$HOME:Help:*"} files]} {
  457.     set men { "Alpha Manual" "Alpha Commands" "Tcl Commands" "(-" "Quick Start" "Readme" "Changes" "(-" }
  458.     foreach f [lsort -ignore $files] {
  459.         set f [file tail $f]
  460.         if {[lsearch $men $f] < 0} {
  461.             lappend men $f
  462.         }
  463.     }
  464.     foreach f $men {
  465.         addHelpMenu $f
  466.     }
  467.     unset men
  468. }
  469.  
  470. #===============================================================================
  471.  
  472.  
  473. proc buildSwitches {} {
  474.     global switchApps
  475.     
  476.     menu -m -n switchTo -p switchProc {"<O<I/NNowノ" "Addノ" "Removeノ" "(-"}
  477.  
  478.     if {[info exists switchApps] && [llength $switchApps]} {
  479.         foreach app $switchApps {
  480.             lappend names [file tail $app]
  481.         }
  482.         foreach name [lsort -ignore $names] {
  483.             addMenuItem -m -l "blah" switchTo $name
  484.         }
  485.     }
  486. }
  487.  
  488.  
  489. proc switchProc {menu name} {
  490.     global switchTo switchApps
  491.  
  492.     if {$name == "Add"} {
  493.         set fname [getfile "Pick an app:"]
  494.         lappend switchApps $fname
  495.         addDef switchApps $switchApps
  496.         buildSwitches
  497.     } elseif {$name == "Remove"} {
  498.         foreach app $switchApps {
  499.             lappend apps [file tail $app]
  500.         }
  501.         set name [listpick -p "Remove which app?" $apps]
  502.         if {[set ind [lsearch $switchApps "*$name"]] >= 0} {
  503.             set switchApps [lreplace $switchApps $ind $ind]
  504.             addDef switchApps $switchApps
  505.             buildSwitches
  506.         }
  507.     } elseif {$name == "Now"} {
  508.         switchApp
  509.     } else {
  510.         if {[set ind [lsearch $switchApps "*$name"]] >= 0} {
  511.             if {[catch {switchTo $name}]} {
  512.                 launch -f [lindex $switchApps $ind]
  513.             }
  514.         }
  515.     }
  516. }
  517.         
  518.  
  519. proc winTileProc {menu item} {
  520.     win$item
  521. }
  522.  
  523.  
  524.  
  525. #             "tiled^3"
  526. #             "overlay^4"
  527.  
  528. # We may be reloading, so add whatever windows we have
  529. if {[info exists winNameToNum]} {
  530.     set nms [array names winNameToNum]
  531.     foreach name $nms {
  532.         regexp {[^:]*$} $name item
  533.         set num $winNameToNum($name)
  534.         if {$num < 10}     {
  535.             addMenuItem -m $winMenu /$num$item
  536.         } else {
  537.             addMenuItem -m $winMenu $item
  538.         }
  539.     }
  540. }
  541.  
  542. insertMenu "File"
  543. insertMenu "Edit"
  544. insertMenu "Text"
  545. insertMenu "Search"
  546. catch {insertMenu "Utils"}
  547. #enableMenuItem NamedClipboards paste off
  548. insertMenu "Config"
  549. insertMenu $winMenu
  550.  
  551.